import os
from datetime import timedelta

BASE_DIR = os.path.abspath(os.path.dirname(__file__))

## sqlite
class Config:
     SECRET_KEY = os.environ.get('SECRET_KEY') or 'change-this-to-random-key'
     SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, '../instance/schedule.sqlite')
     SQLALCHEMY_TRACK_MODIFICATIONS = False
     PERMANENT_SESSION_LIFETIME = timedelta(days=30)


#     # 原来可能是 sqlite:///data.db
#     # 改成下面格式，mysql+pymysql 或 mysql+mysqldb（mysqlclient）
## mysql
# class Config:
#     SQLALCHEMY_DATABASE_URI = os.getenv(
#         "DATABASE_URL",
#         "mysql+pymysql://root:1qaz%40WSX..@192.168.160.130:33306/schedule?charset=utf8mb4"
#     )
#     SQLALCHEMY_TRACK_MODIFICATIONS = False
#     PERMANENT_SESSION_LIFETIME = timedelta(days=30)